<style>
    .lv-check{
        line-height: 24px;
        margin-right: 14px;
    }
    .lv-check-head{
        line-height: 24px;
    }
    .lv-check-head a{
        color: #3367ac !important;
    }
    .lv-check-box{
        position: relative;
        height: 300px;
        transition: height 3s;
    }

</style>
<h3><{t}>基本信息<{/t}></h3>
<div id="x-g-basic" class="goods-detail tableform">

  <div class="division">
    <table border="0" cellpadding="0" cellspacing="0" class="rule_list">
      <tr>
        <th style="width:10%"><{t}>规则名称<{/t}>：</th>
        <td style="width:90%"><{input type="text" class="inputstyle" name="rule[name]" required="true" vtype='required' value=$rule.name size=60 }><em><font color="red">*</font></em></td>
      </tr>
      <tr>
        <th><{t}>规则描述<{/t}>：</th>
        <td><{input type="textarea" style=" width:80%" class="inputstyle" value=$rule.description name="rule[description]" rows="10" }><div ><{t}>(选填)<{/t}></div></td>
      </tr>
      <tr>
        <th><{t}>启用状态<{/t}>：</th>
        <td>
          <label><input type="radio" name="rule[status]"<{if $rule.status != 'false' }> checked="checked"<{/if}> value="true" ><{t}>是<{/t}></label>
          <label><input type="radio" name="rule[status]"<{if $rule.status == "false"}> checked="checked"<{/if}> value="false" ><{t}>否<{/t}></label>
        </td>
      </tr>
      <tr>
        <th><{t}>优先级：<{/t}></th>
        <td><{input type="unsignedint" value=$rule.sort_order name="rule[sort_order]" maxlength="5" size="3"  }></td>
      </tr>
      <tr>
        <th><{t}>生效平台<{/t}>：</th>
        <td id="platform">
          <label><input type="checkbox" value="1" name="rule[apply_platform][]" <{if ($rule.apply_platform != '') && in_array(1,$rule.apply_platform)}>checked<{/if}>/>PC端</label>
          <label><input type="checkbox" value="2" name="rule[apply_platform][]" <{if ($rule.apply_platform != '') && in_array(2,$rule.apply_platform)}>checked<{/if}>/>触屏端</label>
        </td>
      </tr>
      <input type="hidden" name="rule[stop_rules_processing]" value="false" >


      <!--
                <{*
                <{if $promotion_type == 'order'}>
                <tr>
                    <th><{t}>免运费<{/t}>：</th>
                     <td>
                          <label><input type="radio" name="rule[free_shipping]"<{if $rule.free_shipping == 0 }> checked="checked"<{/if}> value="0" ><{t}>不免运费<{/t}></label>
                         <label><input type="radio" name="rule[free_shipping]"<{if $rule.free_shipping == 1}> checked="checked"<{/if}> value="1" ><{t}>满足过滤条件的商品免运费<{/t}></label>
                         <label><input type="radio" name="rule[free_shipping]"<{if $rule.free_shipping == 2}> checked="checked"<{/if}> value="2" ><{t}>免运费<{/t}></label>
                     </td>
                </tr>
                <{/if}>
                *}>
                -->
      <!--
                <tr>
                    <th><{t}>优先级<{/t}>：</th>
                    <td><{input type="digits" value=$rule.sort_order name="rule[sort_order]" maxlength="5" size="3" required="true" vtype='required' }></td>
                </tr>
                -->
      <tr>
        <th><{t}>开始时间<{/t}>：</th>
        <td>
          <{input type="time" value=$rule.from_time vtype="required" name="from_time"}>
        </td>
      </tr>
      <tr>
        <th><{t}>结束时间<{/t}>：</th>
        <td>
          <{input type="time" value=$rule.to_time vtype="required" name="to_time"}>
        </td>
      </tr>
      <tr>
        <th><{t}>渠道商级别<{/t}>：</th>
        <td id="mLev">
            <div class="lv-check-head">
                <label for=""><input type="checkbox" class="all-check">全选</label>
                <a href="javascript:;" class="u-more-btn">查看全部</a>
                <a href="javascript:;"class="u-close-btn" style="display:none">收起</a>
            </div>
            <div class="lv-check-box">
                <{foreach from=$member_level item=ml}>
                <label class="lv-check"><input  type="checkbox" value="<{$ml.member_lv_id}>" name="rule[member_lv_ids][]" <{if ($rule.member_lv_ids != '') && in_array($ml.member_lv_id,$rule.member_lv_ids)}>checked<{/if}>/><{$ml.name}></label>
                <{/foreach}>

            </div>

        </td>
      </tr>
        <tr style="display:none">
        <th><{t}>办事处选择<{/t}>：</th>
        <td id="mLev">
          <{$menus4}>
          
        </td>

      </tr>

            </table>
        </div>
     
</div>

<script>
//    $(function () {
//       $(".u-more-btn").on("click",function () {
//           $(".lv-check-box").css("max-height","none");
//       })
//    });
    window.addEvent('domready', function() {
        $$(".u-more-btn").addEvent("click",function () {
            $$(".lv-check-box").setStyle("height","auto");
            $(this).hide();
            $$(".u-close-btn").show();
        });

        $$(".u-close-btn").addEvent("click",function () {
            $$(".lv-check-box").setStyle("height","300px");
            $(this).hide();
            $$(".u-more-btn").show();
        });

        $$(".all-check").addEvent("change",function () {
            if($(this).getProperty("checked")==true){
                var check=document.getElementsByClassName("lv-check");
                Array.each(check,function (item, index, object) {
                    item.children[0].setAttribute("checked",true);
                })

            }
            else{
                var check=document.getElementsByClassName("lv-check");
                Array.each(check,function (item, index, object) {
                    item.children[0].removeAttribute("checked");
                })
            }


        })
    });
validatorMap['requiredcheckbox'] = [LANG_Validate['requiredonly'], function(element) {
    var parent =  element.getParent('td'),radio;
    if(element.get('name')) radio = parent.getElements('input[type=checkbox][name="'+element.get('name')+'"]');
    else radio = parent.getElements('input[type=checkbox]');
    return radio.some(function(rd) {
        return rd.checked == true;
    });
}];

$ES('#x-g-basic input[name^=rule[stop_rules_processing]').addEvent('click',function(e){
    var proc=$ES('#x-g-basic .processing'),check=this.value;
    proc.each(function(el){
        el[check=='true'?'show':'hide']();
    });
});

</script>

<script>
//@mo 全选
    $$('input.parent').addEvent('change',function(){
        this.getParent().getElements('ul li input[type=checkbox]').set('checked',this.checked);
    })

</script>
<script>
//void function(){
//  //@mo
//    $('showoffice').addEvent('click',function(e){
//        var dp = $('stpl_list1').getStyle('display');
//        if(dp == 'none') {
//            //$(this).innerHTML = '隐藏';
//            $('stpl_list1').setStyle('display','block');
//        } else {
//            //$(this).innerHTML = '显示';
//            $('stpl_list1').setStyle('display','none');
//        }
//    });
//
//
//}();

</script>

